package com.esender.strategy.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Set;

/**
 * 这里得value是要调用得服务得applicationname,即是nacos中得服务名称
 */
@FeignClient(value = "beacon-cache")
public interface BeaconCacheClient {
    @GetMapping("/cache/hget/{key}/{field}")
    String hget(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);

    @GetMapping("/cache/hgetall/{key}")
    public Map hGetAll(@PathVariable(value = "key") String key);

    @GetMapping("/cache/hget/{key}/{field}")
    Integer hgetInteger(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);


    @GetMapping("/cache/get/{key}")
    String get(@PathVariable(value = "key") String key);

    @PostMapping(value = "/cache/sinterstr/{key}/{sinterKey}")
    Set<Object> sinterstr(@PathVariable(value = "key") String key, @PathVariable(value = "sinterKey") String sinterKey, @RequestBody String... value);

    @GetMapping("/cache/smember/{key}")
    Set smember(@PathVariable(value = "key") String key);

    @GetMapping("/cache/zadd/{key}/{score}/{member}")
    Boolean zadd(@PathVariable(value = "key") String key, @PathVariable(value = "score") Long score, @PathVariable(value = "member") Long member);

    @GetMapping("/cache/zRangeByScore/{key}/{start}/{end}")
    int zRangeByScore(@PathVariable(value = "key") String key, @PathVariable(value = "start") Double start, @PathVariable(value = "end") Double end);

    @DeleteMapping("/cache/zRemove/{key}/{member}")
    void zRemove(@PathVariable(value = "key") String key, @PathVariable(value = "member") Object member);

    @GetMapping(value = "/cache/hIncrBy/{key}/{field}/{delta}")
    Long hIncrBy(@PathVariable(value = "key") String key,
                 @PathVariable(value = "field") String field,
                 @PathVariable(value = "delta") Long delta);

    @GetMapping("/cache/smember/{key}")
    Set<Map> smemberMap(@PathVariable(value = "key") String key);
}
